<?php
/**
 * Error controller
 * @author Antonello D'Ippolito (http://www.antonellodippolito.com)
 */

class ErrorController extends Zend_Controller_Action {
    
    public function indexAction(){
      $this->_forward('error');
    }
    
    public function errorAction() {
        $errors = $this->_getParam("error_handler");
        
        switch ($errors->type) {
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
                $this->getResponse()->setHttpResponseCode(404);
                $this->view->errorMessage = 'Controller not found';
                break;
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                $this->getResponse()->setHttpResponseCode(404);
                $this->view->errorMessage = 'Action not found';
                break;
            case "NO_CONTENT":
                $this->getResponse()->setHttpResponseCode(404);
                $this->view->errorMessage = 'Content not found';
                break;
            default:
                $this->getResponse()->setHttpResponseCode(500);
                $this->view->errorMessage = 'Application error';
            break;
        }
        $this->view->errorDescription = $errors->exception->getMessage();
        $this->view->errorTrace = $errors->exception->getTraceAsString();
    }
}
?>
